Type.registerNamespace("Telerik.Web.UI.Editor");
Telerik.Web.UI.Editor.AjaxSpellCheck=function(a){Telerik.Web.UI.Editor.AjaxSpellCheck.initializeBase(this,[a]);
this._language="";
this._editor=null;
this._originalHtml=null;
this._protectedData=[];
this._ignoreTags=new RegExp("<(!--)([\\s\\S]*?)(--)>","gi");
this._ignoreOtherTags=new RegExp("<(object|style)([\\s\\S]*?)(\\/\\1)>","gi");
};
Telerik.Web.UI.Editor.AjaxSpellCheck.prototype={initialize:function(){var a=this.get_editor();
this._finalCheckMessage=a.getLocalizedString("SpellCheckEnd","Finish spellchecking");
this._completeMessage=a.getLocalizedString("SpellCheckComplete","Spellchecking complete!");
this._cancelMessage=a.getLocalizedString("CancelButton","Cancel");
this._addWordSuccessMessage=a.getLocalizedString("AddCustomWordSuccess");
this._spellingInProgressMessage=a.getLocalizedString("SpellingInProgress");
this._spellingModeMessage=a.getLocalizedString("SpellingMode");
this._noSpellingMistakesMessage=a.getLocalizedString("NoSpellingMistakes","No mistakes found.");
this._loadingIconCss="reLoading";
this._createUI();
},get_editor:function(){return this._editor;
},set_editor:function(a){this._editor=a;
},get_language:function(){return this._language;
},set_language:function(a){this._language=a;
},getSpellService:function(){var b=this.get_editor().get_spellCheckService();
var a=this.get_language();
if(a){b.set_language(a);
}return b;
},dispose:function(){if(this._cancelButton){this._cancelButton.Parent=null;
this._cancelButton.onclick=null;
}this._cancelButton=null;
if(this._finishButton){this._finishButton.Parent=null;
this._finishButton.onclick=null;
}this._finishButton=null;
if(this._spellEngine){this._spellEngine.dispose();
}this._editor=null;
this._topElement=null;
this._protectedData=null;
},raiseEvent:function(b,c){var a=this.get_events().getHandler(b);
if(a){if(!c){c=Sys.EventArgs.Empty;
}a(this,c);
}},add_spellCheckStart:function(a){this.get_events().addHandler("spellCheckStart",a);
},remove_spellCheckStart:function(a){this.get_events().removeHandler("spellCheckStart",a);
},add_spellCheckEnd:function(a){this.get_events().addHandler("spellCheckEnd",a);
},remove_spellCheckEnd:function(a){this.get_events().removeHandler("spellCheckEnd",a);
},spellCheck:function(){if(!this._spellEngine){this._spellEngine=new Telerik.Web.UI.Editor.SpellEngineUI(this.get_editor(),this);
this._spellEngine.onSpellCheckComplete=Function.createDelegate(this,function(){this.finishSpellCheck();
alert(this._completeMessage);
});
this._spellEngine.onAddCustomWord=Function.createDelegate(this,function(c){this.addCustomWord(c);
});
}if(this._spellEngine._spellcheckComplete){this.finishSpellCheck(false);
}this._setVisible(true);
this._setLoadingIconVisible(true);
this._enableButtons(false);
this._originalHtml=this.get_editor().get_contentArea().innerHTML;
var b=this.getSpellService();
var a=Function.createDelegate(this,function(c,d){b.remove_complete(a);
this.beginSpellCheck(d);
});
b.add_complete(a);
this._saveSpecialContent();
b.spellCheck(this._spellEngine._escapeNewLines(this._originalHtml));
},beginSpellCheck:function(a){this._setLoadingIconVisible(false);
this._enableButtons(true);
this.raiseEvent("spellCheckStart");
if(a.badWords.length==0){alert(this._noSpellingMistakesMessage);
this.finishSpellCheck();
}else{this._spellEngine.initialize(a,this._originalHtml);
}},finishSpellCheck:function(a){this._setVisible(false);
this._spellEngine.finalize();
this.restoreSavedContent();
this._originalHtml=null;
if(false!=a){this.raiseEvent("spellCheckEnd");
}},cancelSpellCheck:function(){this._setVisible(false);
this._spellEngine.finalize(false);
if(null!=this._originalHtml){Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this.get_editor().get_contentArea(),this._originalHtml);
this._originalHtml=null;
}this.restoreSavedContent();
var a=this.get_editor().get_commandsManager();
var b=a.get_commands();
a.removeCommandAt(b.length-1);
this.raiseEvent("spellCheckEnd");
this.get_editor().raiseEvent("selectionChange",Sys.EventArgs.Empty);
},_saveSpecialContent:function(){this._protectedData=[];
var a=Function.createDelegate(this,function(e,b,d,f,g,c){Array.add(this._protectedData,"<"+b+d+f+">");
return"<RADEDITORFORMATTED_"+this._protectedData.length+"/>";
});
this._originalHtml=this._originalHtml.replace(this._ignoreTags,a);
this._originalHtml=this._originalHtml.replace(this._ignoreOtherTags,a);
},restoreSavedContent:function(){if(this._protectedData&&this._protectedData.length>0){var b=this.get_editor().get_contentArea().innerHTML;
for(var c=0;
c<this._protectedData.length;
c++){var a=new RegExp("<RADEDITORFORMATTED_"+(c+1)+"\\s*\\/>");
b=b.replace(a,this._protectedData[c]);
}Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this.get_editor().get_contentArea(),b);
}},addCustomWord:function(b){var d=this.getSpellService();
var a=this._spellEngine;
var c=this._addWordSuccessMessage;
var e=function(f,g){d.remove_complete(e);
alert(b+" "+c);
a.clearWrongWords(b,b);
var h=a.isHighlightedRemaining();
if(!h){a._suggestionDropdown.hide();
a.onSpellCheckComplete();
return;
}a.moveToNextWrongWord();
};
d.add_complete(e);
d.addCustomWord(b);
},_createUI:function(){var c=document;
var d=c.createElement("table");
d.cellSpacing=2;
d.cellPadding=0;
d.className="reAjaxspell_wrapper";
d.style.width="100%";
d.style.backgroundColor="#ffffcc";
d.style.clear="both";
d.style.borderBottom="1px solid #adadad";
d.insertRow(-1);
var a=d.rows[0].insertCell(-1);
a.style.width="100%";
var b=c.createElement("button");
b.className="reAjaxspell_button";
a=d.rows[0].insertCell(-1);
this._finishButton=b.cloneNode(true);
this._finishButton.Parent=this;
this._finishButton.innerHTML=this._finalCheckMessage;
this._finishButton.onclick=new Function("this.Parent.finishSpellCheck();return false;");
a.appendChild(this._finishButton);
a=d.rows[0].insertCell(-1);
this._cancelButton=b.cloneNode(true);
this._cancelButton.Parent=this;
this._cancelButton.innerHTML=this._cancelMessage;
this._cancelButton.onclick=new Function("this.Parent.cancelSpellCheck();return false;");
a.appendChild(this._cancelButton);
this._topElement=d;
this.get_element().appendChild(this._topElement);
},_setVisible:function(a){this._topElement.style.display=a?"":"none";
},_enableButtons:function(a){var b=this._topElement.getElementsByTagName("button");
for(var c=0;
c<b.length;
c++){b[c].disabled=!a;
}},_setLoadingIconVisible:function(c){var a=this._topElement.rows[0].cells[0];
a.innerHTML="";
if(c){var b=document.createElement("SPAN");
b.className=this._loadingIconCss;
a.appendChild(b);
a.innerHTML+="<label>"+this._spellingInProgressMessage+"</label>";
}else{a.innerHTML="<label>"+this._spellingModeMessage+"</label>";
}}};
Telerik.Web.UI.Editor.AjaxSpellCheck.registerClass("Telerik.Web.UI.Editor.AjaxSpellCheck",Sys.UI.Control);
Telerik.Web.UI.Editor.SpellEngineUI=function(b,a){this._editor=b;
this._parentControl=a;
this._suggestionDropdown=null;
this._suggestionBox=null;
this._wrongWordCounter=0;
this._wrongWordsArray=null;
this._spanId="RadESpellError_";
this._selectedEditorElement=null;
this._spellcheckComplete=true;
this._automaticAdvance=true;
this._localizedCommandName=this._editor.getLocalizedString("spellCheck","Check spelling");
this._localizedName=this._editor.getLocalizedString("SpellingChange","Spelling Change");
this._noSuggestionsString=this._editor.getLocalizedString("NoSuggestions","(no suggestions)");
this._changeWordString=this._editor.getLocalizedString("ChangeWordString","Change");
this._ignoreAllString=this._editor.getLocalizedString("IgnoreAllString","Ignore All");
this._ignoreString=this._editor.getLocalizedString("IgnoreString","Ignore");
this._moreThanOnceMessage=this._editor.getLocalizedString("MoreThanOnceMessage","This word occurs more than once in the text. Would you like to replace all instances?");
this._undoDisabledMessage=this._editor.getLocalizedString("UndoDisabledMessage","You cannot undo further while in spellcheck mode. Please finish spellchecking first.");
this._addToDictionaryString=this._editor.getLocalizedString("AddToDictionary","Add to dictionary");
this._addIconCss="reAjaxspell_addicon";
this._okIconCss="reAjaxspell_okicon";
this._ignoreIconCss="reAjaxspell_ignoreicon";
};
Telerik.Web.UI.Editor.SpellEngineUI.prototype={onAddCustomWord:function(a){},onSpellCheckComplete:function(){},dispose:function(){this._editor=null;
this.onSpellCheckComplete=null;
},_configureUndo:function(d){if(d){this._editor.enableEditing(true);
var a=this._editor.get_commandsManager();
var e=a.get_commands();
var c=this._currentUndoIndex;
while(c<e.length){a.removeCommandAt(e.length-1);
}this._editor.executeCommand(this.SaveStateCmd);
if(this._onCommandExecutingDelegate){this._editor.remove_commandExecuting(this._onCommandExecutingDelegate);
}this._onCommandExecutingDelegate=null;
}else{var b=this._editor.get_commandsManager();
this._currentUndoIndex=b.getCommandsToUndo().length;
this._onCommandExecutingDelegate=Function.createDelegate(this,function(f,h){var g=h.get_commandName();
if(g=="Undo"&&this._currentUndoIndex>=b.getCommandsToUndo().length){alert(this._undoDisabledMessage);
h.set_cancel(true);
}});
this._editor.add_commandExecuting(this._onCommandExecutingDelegate);
this._editor.enableEditing(false,Telerik.Web.UI.EditingOptions.All,{Undo:true,Redo:true,AjaxSpellCheck:true});
}},finalize:function(b){if(true!=this._initialized){return;
}if(false!=b){this.clearWrongWords();
}if(this._parentControl){this._parentControl.restoreSavedContent();
this._parentControl=null;
}var a=this._editor;
if(this.OnMouseHandler){a.detachEventHandler("click",this.OnMouseHandler);
}if(this.OnKeyDownHandler){a.detachEventHandler("keydown",this.OnKeyDownHandler);
}if(this.OnContextMenu){a.detachEventHandler("contextmenu",this.OnContextMenu);
}if(this.OnEditorSubmit){a.remove_submit(this.OnEditorSubmit);
}this._configureUndo(true);
a.setFocus();
a.raiseEvent("selectionChange",Sys.EventArgs.Empty);
this._wrongWordsArray=null;
this._spellcheckComplete=true;
this._initialized=false;
},initialize:function(b,a){this._initialized=true;
this._wrongWordsArray=b.badWords;
this._wordOffsets=b.wordOffsets;
var d=this._editor;
this.SaveStateCmd=new Telerik.Web.UI.Editor.GenericCommand(this._localizedCommandName,d.get_contentWindow());
this.markWrongWords(a);
this._spellcheckComplete=false;
this._wrongWordCounter=0;
var c=this;
this.OnEditorSubmit=function(){c.finalize();
};
this._editor.add_submit(this.OnEditorSubmit);
this.OnMouseHandler=function(f){c._showSuggestionDropdown();
return $telerik.cancelRawEvent(f);
};
this.OnKeyDownHandler=function(j){if(j.keyCode==9){c.moveToNextWrongWord();
return $telerik.cancelRawEvent(j);
}var i=false;
if(c._suggestionDropdown){var g=c._suggestionDropdown;
var f=(g.isExpanded());
var h=j.keyCode;
if(f){if(38==h){g.selectPreviousItem();
i=true;
}else{if(40==h){g.selectNextItem();
i=true;
}else{if(13==h){g.hide();
if(g.get_activeIndex){g.set_selectedIndex(g.get_activeIndex());
}c._onDropDownValueSelected(g);
try{j.keyCode=123;
}catch(j){}i=true;
}else{if(27==h){g.hide();
}}}}i=true;
}}if(i){return $telerik.cancelRawEvent(j);
}};
this.OnContextMenu=function(f){if(this._editor.isIE){c.OnMouseHandler(f);
}f.cancelBubble=true;
if(this._editor.isIE){return false;
}};
window.setTimeout(function(){var h=c._editor;
h.attachEventHandler("click",c.OnMouseHandler);
h.attachEventHandler("keydown",c.OnKeyDownHandler);
h.attachEventHandler("contextmenu",Function.createDelegate(c,c.OnContextMenu));
if(c._automaticAdvance){h.setFocus();
if(h.isIE){try{var f=h.getSelection().getRange();
if(f){f.moveToElementText(h.get_contentArea());
f.collapse();
f.select();
}}catch(g){}}c.moveToNextWrongWord();
}},50);
this._configureUndo(false);
},moveToNextWrongWord:function(){var d=-1;
var c=this._editor.getSelection();
var a=c.getParentElement();
var h=null;
if(this.isHighlightedWord(a)&&!this._editor.getSelectionHtml()){h=a;
}else{c.Collapse();
var f=this._editor;
var b=this;
var l=null;
function m(){var p=f.get_document().getElementsByTagName("SPAN");
var o=0;
var e=p[o];
l=f.getSelection().getRange();
while(e!=null){if(b.isHighlightedWord(e)){var n=null;
if(f.isIE){if(l.duplicate){tempRange=l.duplicate();
}else{tempRange=f.get_contentArea().createTextRange();
}if(tempRange.moveToElementText){tempRange.moveToElementText(e);
}if(!l.compareEndPoints){break;
}n=l.compareEndPoints("EndToStart",tempRange);
if(0==n){h=e;
break;
}}else{if(l){tempRange=l.cloneRange();
tempRange.selectNodeContents(e);
n=l.compareBoundaryPoints(Range.END_TO_START,tempRange);
}}if(d==n){h=e;
break;
}}o++;
e=p[o];
}return e;
}var h=m();
if(!h){var g=f.get_contentArea();
if(g&&g.createTextRange){var j=g.createTextRange();
j.moveToElementText(g);
j.collapse(true);
j.select();
}else{var i=f.get_document().getElementsByTagName("SPAN")[0];
if(i){f.selectElement(i);
}}try{var l=f.getSelection().getRange();
if(l&&l.moveStart){l.moveStart("character",-1);
l.select();
}}catch(k){}f.getSelection().Collapse(true);
h=m();
}}if(h){this._editor.selectElement(h);
$telerik.scrollIntoView(h);
this._showSuggestionDropdown();
}},clearWrongWords:function(a,c){var e=this._editor.get_document().getElementsByTagName("SPAN");
for(var d=0;
d<e.length;
d++){var b=e[d];
if(this.isHighlightedWord(b)){if(a){if(b.innerHTML==a){this.clearHighlightedElement(b,c);
d--;
}continue;
}else{this.clearHighlightedElement(b);
}d--;
}}},isHighlightedRemaining:function(){var c=this._editor.get_document().getElementsByTagName("SPAN");
for(var b=0;
b<c.length;
b++){var a=c[b];
if(this.isHighlightedWord(a)){return true;
}}return false;
},getCurrentWrongWord:function(){var b=this._selectedEditorElement;
var a=b.innerHTML.replace(/<\/?[^>]*>/ig,"");
return a;
},isHighlightedWord:function(a){if(!a||!a.getAttribute){return false;
}var b=a.getAttribute("id");
if(b&&b.indexOf(this._spanId)>-1){return true;
}return false;
},clearHighlightedElement:function(b,c,e){var a=true;
if(b!=this._selectedEditorElement){a=false;
}var f=c?c:b.innerHTML.replace(/<\/?[^>]*>/ig,"");
var d=c?true:false;
this._editor.selectElement(b,false);
var h=new Telerik.Web.UI.Editor.GenericCommand(this._localizedName,this._editor.get_contentWindow());
var i=this._editor.get_document().createTextNode(f);
b.parentNode.replaceChild(i,b);
var g=this._editor.isIE;
if(g&&!f&&!c&&!e){return;
}if(g){if(e){this._editor.setActive();
}else{range=this._editor.get_contentArea().createTextRange();
range.findText(i.data);
range.select();
}}else{this._editor.selectElement(i,false);
}this._editor.getSelection().collapse();
if(d){this._editor.executeCommand(h);
}if(a){this._selectedEditorElement=null;
}},markWrongWords:function(b){var c=function(g,f,e,d){this.badWords=g;
this._wordOffsets=f;
this._spanId=e;
this.Content=d;
this.CurrentWordIndex=0;
this.Result=null;
};
c.prototype={GetSplitContent:function(){var f=new Array(this.badWords.length*2+1);
for(var e=0;
e<this.badWords.length;
e++){var d=e*2;
f[d]=this.GetBeforeText(e);
f[d+1]=this.badWords[e].wordString;
}f[f.length-1]=this.GetLastText();
return f;
},GetMarkedSplitContent:function(d){for(var e=1;
e<d.length;
e+=2){d[e]=this.GetMarkedWord(d[e]);
this.CurrentWordIndex++;
}return d;
},GetBeforeText:function(d){var e=0;
var f=this.GetWordStartIndex(this.badWords[d]);
if(d!=0){badWordBefore=this.badWords[d-1];
e=this.GetWordEndCharIndex(badWordBefore);
}return this.Content.substring(e,f);
},GetLastText:function(){var d=this.badWords[this.badWords.length-1];
var e=this.GetWordEndCharIndex(d);
var f=this.Content.length;
return this.GetSubContent(e,f);
},GetWordEndCharIndex:function(d){return this.GetWordStartIndex(d)+d.wordString.length;
},GetSubContent:function(e,d){return this.Content.substring(e,d);
},GetWordStartIndex:function(d){return this._wordOffsets[d.textOffset];
},GetMarkedWord:function(d){return"<span class='RadEWrongWord' id='"+this._spanId+this.CurrentWordIndex+"'>"+d+"</span>";
},GetResult:function(){if(this.Result==null){this.Result=this.GetMarkedSplitContent(this.GetSplitContent()).join("");
}return this.Result;
}};
var a=new c(this._wrongWordsArray,this._wordOffsets,this._spanId,this._escapeNewLines(b));
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this._editor.get_contentArea(),this._unescapeNewLines(a.GetResult()));
},_escapeNewLines:function(b){var a=b.replace(/\n/gi,"<telerikcr />");
a=a.replace(/\r/gi,"<teleriklf />");
return a;
},_unescapeNewLines:function(b){var a=b.replace(/\<telerikcr\s*\/\>/gi,"\n");
var a=a.replace(/\<teleriklf\s*\/\>/gi,"\r");
return a;
},_getSuggestionsForWord:function(a){var f=this._wrongWordsArray;
for(var d=0;
d<f.length;
d++){var e=f[d].wordString;
if(e==a){var b=f[d].suggestionsString;
if(b.length==0){return[["",this._noSuggestionsString]];
}else{b=b.concat([]);
for(var c=0;
c<b.length;
c++){b[c]=[b[c],b[c]];
}}return b;
}}return[];
},_get_footerItems:function(a){var b=[];
if(this._editor.get_spellAllowAddCustom()){b.splice(0,0,["reAdd_to_dictionary",this._addToDictionaryString,this._addIconCss]);
}b.splice(0,0,["reChange",this._changeWordString,this._okIconCss]);
if(this._occursMoreThanOnce(a)){b.splice(0,0,["reIgnore_all",this._ignoreAllString,this._ignoreIconCss]);
}b.splice(0,0,["",this._ignoreString,this._ignoreIconCss]);
return b;
},_occursMoreThanOnce:function(a){var b=this._editor.get_text();
var d=new RegExp("(\\b)"+a+"(\\b)","g");
var c=b.match(d);
return(c&&c.length>1);
},fire:function(d,c){var g=c.SelectedValue;
var h=this._selectedEditorElement&&this._selectedEditorElement.innerHTML?this._selectedEditorElement.innerHTML:"";
if(g=="reAdd_to_dictionary"){if(h.length>0){this.onAddCustomWord(this.getCurrentWrongWord());
}}else{if(g=="reIgnore_all"){this.clearWrongWords(h,"");
}else{if(g=="reChange"){this._showSuggestionBox(this._selectedEditorElement);
return;
}else{var e=false;
if(g){var f=this._occursMoreThanOnce(h);
if(f){var b=confirm(this._moreThanOnceMessage);
if(b){this.clearWrongWords(h,g);
e=true;
}}}if(!e){this.clearHighlightedElement(this._selectedEditorElement,g,true);
}}}}var a=this.isHighlightedRemaining();
if(!a){this.onSpellCheckComplete();
return;
}this._editor.raiseEvent("selectionChange",Sys.EventArgs.Empty);
if(this._automaticAdvance){this.moveToNextWrongWord();
}},_onDropDownValueSelected:function(c,b){var a=c.get_selectedItem();
this.fire("",{SelectedValue:a});
},_onDropDownBeforeShow:function(a,b){var d=this.getCurrentWrongWord();
var c=this._getSuggestionsForWord(d);
a.set_items(c);
},_showSuggestionDropdown:function(){var d=this._editor;
var b=d.getSelection().getParentElement();
if(!this.isHighlightedWord(b)){return;
}this._selectedEditorElement=b;
var f=this.getCurrentWrongWord();
if(!this._suggestionDropdown){this._onDropDownValueSelectedDelegate=Function.createDelegate(this,this._onDropDownValueSelected);
this._onDropDownBeforeShowDelegate=Function.createDelegate(this,this._onDropDownBeforeShow);
var a={valueSelected:this._onDropDownValueSelectedDelegate,show:this._onDropDownBeforeShowDelegate};
var c={};
c.popupwidth="160px";
c.parentElement=d.get_contentAreaElement();
c.skin=d.get_skin();
c.sizetofit=true;
var e=$create(Telerik.Web.UI.EditorSpellSuggestionBox,c,a,null,document.createElement("SPAN"));
this._suggestionDropdown=e;
}var e=this._suggestionDropdown;
e.hide();
e.set_footerItems(this._get_footerItems(f));
e.set_wrongWordWrapper(b);
e.show();
e.selectNextItem();
if(d.isIE){d.setFocus();
}},_onTextboxValueSelected:function(a,b){var c=a.get_selectedItem();
this._editor.setFocus();
this.fire("",{SelectedValue:c});
},_showSuggestionBox:function(b){var d=this._editor;
if(!this._suggestionBox){this._onTextboxValueSelectedDelegate=Function.createDelegate(this,this._onTextboxValueSelected);
var a={valueSelected:this._onTextboxValueSelectedDelegate};
var c={};
c.parentElement=d.get_contentAreaElement();
c.skin=d.get_skin();
c.sizetofit=true;
var e=$create(Telerik.Web.UI.EditorAjaxSpellTextbox,c,a,null,document.createElement("SPAN"));
this._suggestionBox=e;
}var f=this._suggestionBox;
var g=this.getCurrentWrongWord();
window.setTimeout(function(){f.set_wrongWordWrapper(b);
f.show();
f.setValue(g);
},10);
}};
Telerik.Web.UI.EditorSpellSuggestionBox=function(a){Telerik.Web.UI.EditorSpellSuggestionBox.initializeBase(this,[a]);
this._parentElement=null;
this._wrongWordWrapper=null;
this._maxItemSize=5;
};
Telerik.Web.UI.EditorSpellSuggestionBox.prototype={dispose:function(){this._wrongWordWrapper=null;
Telerik.Web.UI.EditorSpellSuggestionBox.callBaseMethod(this,"dispose");
},initialize:function(){this.set_popupclassname("reAjaxSpellCheck");
},set_footerItems:function(a){this._footerItems=a;
},renderChildren:function(){Telerik.Web.UI.EditorSpellSuggestionBox.callBaseMethod(this,"renderChildren");
var m=20;
var b=this._items.length>this._maxItemSize?this._maxItemSize:this._items.length;
var l=b>1?(b*m):25;
var c=document.createElement("DIV");
c.style.overflow="auto";
c.style.height=l+"px";
c.className="reAjaxSpellCheckSuggestions";
var d=this._itemRootElement;
d.cellSpacing="0";
var h=d.parentNode;
h.removeChild(d);
c.appendChild(d);
c.style.overflowX="hidden";
c.style.width="100%";
var f=this.renderItemRoot();
f.cellSpacing="0";
h.appendChild(f);
this.renderNewRow();
var k=this.renderItemContainer();
k.appendChild(c);
var j=document.createElement("DIV");
j.className="reAjaxSpellCheckSeparator";
k.appendChild(j);
var e=this._items.length;
for(var a=0;
a<this._footerItems.length;
a++){this.renderNewRow();
var g=this.renderItemContainer();
this.markItemContainer(g,e);
this.renderChild(g,this._footerItems[a],e);
e++;
}this._items=this._items.concat(this._footerItems);
},configurePopupPropertiesBeforeShow:function(){var e=this._popupBehavior;
e.set_positioningMode(Telerik.Web.PositioningMode.Absolute);
var c=this.get_parentElement();
if(c){e.set_parentElement(c);
}var d=this.get_wrongWordWrapper();
if(d){var b=$telerik.getBounds(d);
e.set_x(b.x);
var a=($telerik.isFirefox)?b.y+b.height-c.contentDocument.body.scrollTop:b.y+b.height;
e.set_y(a);
}},get_parentElement:function(){return this._parentElement;
},set_parentElement:function(a){this._parentElement=a;
},get_maxItemSize:function(){return this._maxItemSize;
},set_maxItemSize:function(a){this._maxItemSize=a;
},get_wrongWordWrapper:function(){return this._wrongWordWrapper;
},set_wrongWordWrapper:function(a){this._wrongWordWrapper=a;
}};
Telerik.Web.UI.EditorSpellSuggestionBox.registerClass("Telerik.Web.UI.EditorSpellSuggestionBox",Telerik.Web.UI.EditorSplitButton);
Telerik.Web.UI.EditorAjaxSpellTextbox=function(a){Telerik.Web.UI.EditorAjaxSpellTextbox.initializeBase(this,[a]);
};
Telerik.Web.UI.EditorAjaxSpellTextbox.prototype={dispose:function(){if(null!=this._element){this._element.onchange=null;
this._element.onkeypress=null;
this._element.onclick=null;
this._element.Parent=null;
}this._element=null;
Telerik.Web.UI.EditorAjaxSpellTextbox.callBaseMethod(this,"dispose");
},setValue:function(b){if(this._textElement){this._textElement.value=b;
}var c=this._textElement;
try{if(c){c.focus();
}if(c&&c.setActive){c.setActive();
var a=document.selection.createRange();
a.moveStart("word",1);
a.select();
a.collapse();
}}catch(d){}},get_selectedItem:function(){return this._textElement.value;
},fire:function(){this.hide();
this.raiseEvent("valueSelected");
},attachEventHandlers:function(){},show:function(){if(!this._rendered){this.render();
}this._show();
},configurePopupPropertiesBeforeShow:function(){Telerik.Web.UI.EditorAjaxSpellTextbox.callBaseMethod(this,"configurePopupPropertiesBeforeShow");
var c=this._popupBehavior;
var b=this.get_wrongWordWrapper();
if(b){var a=$telerik.getBounds(b);
c.set_y(a.y);
}},renderChildren:function(){},renderItemRoot:function(){this._createBox();
this._itemRootElement=this._element;
return this._itemRootElement;
},_createBox:function(){var d=document.createElement("INPUT");
d.setAttribute("size","20");
d.Parent=this;
var b=function(h,g,f){if(f){if(g.Executed){g.Executed=false;
return $telerik.cancelRawEvent(h);
}}g.Executed=true;
g.Parent.fire();
return $telerik.cancelRawEvent(h);
};
d.onclick=new Function("this.focus();");
d.onkeypress=function(f){if(!f){f=window.event;
}if(f&&f.keyCode==13){return b(f,this);
}};
this._textElement=d;
var a=document.createElement("div");
var c=document.createElement("button");
c.onmousedown=new Function("e","return false;");
c.onclick=new Function("e","this.parentNode.getElementsByTagName('input')[0].Parent.fire();return false;");
c.className="reAjaxspell_okicon";
a.appendChild(d);
a.appendChild(c);
this._element=a;
return this._element;
}};
Telerik.Web.UI.EditorAjaxSpellTextbox.registerClass("Telerik.Web.UI.EditorAjaxSpellTextbox",Telerik.Web.UI.EditorSpellSuggestionBox);
